<?php @session_start();
include 'clsGiangVien.php';
$gv = new GiangVien(); 
if(empty($_SESSION['gv'])){
	header("Location: gv-dangnhap.php");
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Trang Chủ Quản Trị</title>
<style type="text/css">
<!--
a	{
		color: #006600;
		text-decoration: none;
	}
.mau{background:#FFCC99;}
image{border:none;}

a:hover { COLOR: #CC0000}

.style1 {
	color: #FFFFFF;
	font-weight: bold;
	font-size: 30px;
}
.style2 {
	font-size: 18px;
	font-weight: bold;
	color: #FFFFFF;
  
}
.style3 {font-size: 14px; font-weight: bold; color: #FFFFFF; }
.style4 {color: #006600; font-weight: bold; font-size: 18px; }
.style5 {color:#0000000; font-weight: bold; font-size: 18px; }
.format {}
-->
</style>
</head>

<body>
	<?php $message = "";
		if(isset($_POST['lietke'])){
         	$namhoc = $_POST['namhoc'];
         	$hocki = $_POST['hocki'];
         	//echo "Nam hoc " .$namhoc. " hoc ki " .$hocki;
         	$magv = $_SESSION['gv'];
         	$hp = $gv->getDanhSachHP($namhoc, $hocki, $magv);
         	//print_r($hp);
         	if(empty($hp)) $message = '<p style="color: red">Không có học phần nào trong học kì này</p>';
         		
     }?>
<table width="900px" height="600px" border="0" bordercolorlight="#CCCCCC" align="center" cellpadding="0" cellspacing="0" style="border:1px solid #CCCCCC">

<!-- đầu trang --> 	
    <tr> <td width="900px" height="70px" background="../image/header.gif">
    	
        <table width="100%" height="100%" border="0"> 
             <tr>
       		
				    <td width="10%" rowspan="2"><img src="../image/logo.gif" width="100%" height="70" /></td>
					
					<td width="70%" rowspan="2" height="70" align="center" style="font-size:24px"><div align="right">
					  <blockquote>
						<p><span class="style1">WEBSITE GHI NHẬT KÍ HỌC PHẦN</span></p>
					  </blockquote>
				  </div></td>
        
            </tr> 
			<?php 
			if(isset($_SESSION['gv']) && !empty($_SESSION['gv'])){
				$session = $_SESSION['gv'];
				//echo $session;
				$taikhoan = $gv->getTenGV($session);
			
			}?>
			<tr>
				<td width="32%" valign="bottom" colspan="2" align="right"> <table>
					  <tr><td valign="bottom">
				  			<div align="center" class="style3">Xin chào <?php echo $taikhoan[0][0]; ?> </div></td>
		  			  </tr> 
					  <tr><td valign="bottom">
					  <div align="center" class="style3" style="margin-right: 10px">
						<a class="style3" href="../logout.php">Thoát</a></div></td></tr>
					  
				       </table>
			    </td> 
			</tr>
			
	    </table>
    
    </td> </tr>
<!--menu ngang -->
   <tr bordercolor="#999999" height="10" valign="top" align="center">
  	 <td style="border-color: #266886"><?php echo $message; ?></td>
   </tr>

<!-- thân trang -->  
   
    <tr > 
    	
	      <td valign="top" bordercolor="#FFFFFF">
	      	
    	         <table width="80%" bordercolor="#266886" cellspacing="0" cellpadding="0" align="center" border="1">
	    	         <tr bordercolor="#FFFFFF"> 
        	             <td height="35px" colspan="3" align="center" style="background-color: #266886">
	            			<span style="font-size:15px; color:#FFFFFF; font-weight:bold;">Chọn Học Kì</span>
					     </td>
					</tr>
					
					<tr style="height: 15px">
					</tr>
					
					<tr>
						<form id="sendIf" name="sendIf" action="" method="post">
								<td width="45%" align="right" valign="top" style="border: none;"><label>Năm Học</label> 
									<select name="namhoc" id="namhoc" style="width:90px">
											<?php $namhoc = $gv->getNamHoc($session);
											foreach ($namhoc as $nh)
												echo "<option value=".$nh[0].">" .$nh[0]. "</option>"
												?>
									</select>
								</td>
								
								<td style="border: none;"><label style="margin-left: 15px">Học kì</label> <select name="hocki" id="hocki">
										<?php $hocki = array(1 => 1, 2 => 2, 3 => "Hè");
										//echo $hocki[0][0];
										foreach ($hocki as $key => $value){
											echo "<option value=".$key.">" .$value . "</option>";
										}
										
										?>
								</select>
								<input name="lietke" type="submit" value="Liệt kê" style="margin-left: 10px" />
								</td>
						</form>
					</tr>
					
					<tr style="height: 15px">
					</tr>
				</table>
         </td>
        
	 </tr>
	<tr style="clear: both">
	 <td bordercolor="#FFFFFF" valign="top">
         	<table width="90%" bordercolor="#266886" cellspacing="0" cellpadding="0" align="center" border="1">
         		<tr align="center" style="height: 35px; background-color: #266886; font-style: bold">
		         	
		         	<td><label style="color:#FFFFFF;">Stt</label></td>
		         	<td><label style="color:#FFFFFF;">Mã học phần</label></td>
		         	<td><label style="color:#FFFFFF;">Tên học phần</label></td>
		         	<td><label style="color:#FFFFFF;">Nhóm</label></td>
		         	<td><label style="color:#FFFFFF;">Thứ</label></td>
		         	<td><label style="color:#FFFFFF;">Tiết</label></td>
		         	<td><label style="color:#FFFFFF;">Phòng</label></td>
		         	<td><label style="color:#FFFFFF;">Ghi nhật kí</label></td>
		         	<td><label style="color:#FFFFFF;">Mã truy cập</label></td>
		         	
	         	</tr>
	         	
	         	<?php foreach ($hp as $hocphan)
	         		echo '<tr bordercolor="#096895" ><td class="format"></td>
	         			<td class="format">' . $hocphan[0]. '</td><td class="format">' .$hocphan[1]. '</td>
	         			<td>' .$hocphan[2]. '</td><td>' .$hocphan[3]. '</td><td>' .$hocphan[4]. '</td>
	         			<td>' .$hocphan[5]. '</td>
	         			<td class="format" align="center"><a href="ghinhatki.php?mahocphan='.$hocphan[0].'&nhomhocphan='.$hocphan[2].
	         				'&hocki='.$hocphan[6].'&namhoc='.$hocphan[7].'">
							<img src="../image/note.png" alt="Nhật kí"></a></td>
						<td class="format" align="center"><a href="datmatruycap.php?mahocphan='.$hocphan[0].'&nhomhocphan='.$hocphan[2].
	         				'&hocki='.$hocphan[6].'&namhoc='.$hocphan[7].'">
							<img src="../image/lock.png" alt="Truy cập"></a></td><tr>'?>
         	</table>
         </td>
	</tr>
	<tr>
	
	</tr>
<!-- cuối trang -->  
	<tr> 
	      <td height="28" background="../image/footer.gif" class="style3" align="center" > Copyright @ by Nhóm phát triển
	     </td>
    </tr>
<!-- het cuoi trang-->

</table>

</body>
</html>

